<?php

$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
if($_RQ['op']=='list'){
	$pindex = max(1, intval($_SESSION['page']));
	$psize = 10;
	$params=array('uniacid'=>$_SESSION['uniacid']);
    $fields=array();
    $orderby='id desc';
	$total='';
	$return['list']=pdo_getslice('jy_weishop_goodscard_getlog',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	$return['gettype']=array('1'=>'充值兑换','2'=>'活动赠送','3'=>'朋友赠送');
	foreach($return['list'] as &$v){
		$v['createtime']=$v['createtime']?date('Y/m/d H:m:s',$v['createtime']):'--';
		$v['usetime']=$v['usetime']?date('Y/m/d H:m:s',$v['usetime']):'--';
		$v['nickname']=pdo_getcolumn('core_members',array('id'=>$v['mid']),'nickname');
		$v['title']=pdo_getcolumn('jy_weishop_goodscard',array('id'=>$v['cardid']),'title');
		$v['money']=pdo_getcolumn('jy_weishop_goodscard',array('id'=>$v['cardid']),'money');
	}
	$htmls=array(
		'type'=>'list',
		
		'list'=>array('data'=>'list','edit'=>false,'list'=>array(
			array('name'=>'title','title'=>'购物卡名称','type'=>'string'),
			array('name'=>'money','title'=>'购物卡面额','type'=>'string'),	
			array('name'=>'nickname','title'=>'会员昵称','type'=>'string'),
			array('name'=>'gettype','title'=>'获得方式','type'=>'radio','options'=>'gettype'),
			array('name'=>'createtime','title'=>'获得时间','type'=>'string'),
			array('name'=>'usetime','title'=>'使用时间','type'=>'string'),		
		)),
	);
	$return['htmls']=$htmls;	
	exi($return);
}
if($_RQ['op']=='del'){

	$id=intval($_RQ['id']);
	if($id){
		pdo_delete('jy_weishop_goodscard_getlog',array('id'=>$id));	
	}
	$del=trim($_RQ['del'],';');
	if($del){
		$del=explode(';',$del);
		foreach($del as $id){
			$id=intval($id);
			if($id){
				pdo_delete('jy_weishop_goodscard_getlog',array('id'=>$id));
			}
		}
	}
	exi('删除成功！');
}	

?>